package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name ="王克晶";
        int age=18;
        char gender='女';
        String[] otherInfo ={"长的好"};
        Persson p = new Persson(name,age,gender,otherInfo);
        FileOutputStream fos = new FileOutputStream("person.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
           /*
            对象流提供的重要方法:
            void writeObject(Object obj)
            将给定的对象序列化为一组字节，再将其通过链接的流写出
         */
        oos.writeObject(p);
        System.out.println("写出完毕");
        oos.close();
    }
    }

